﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Media;





namespace main_fx
{
    public partial class cronometro : Form
    {
        int  segundos=0;
        int cont = 0;
        double milissegundos = 0;

        string foto;
        Assembly myAssembly = Assembly.GetExecutingAssembly();

        //WaveStream mp3Reader = new Mp3FileReader(@"Resources\buzina.mp3");
        
        

        String[] img = new String[10] { "_0.gif", "_1.gif", "_2.gif", "_3.gif", "_4.gif", "_5.gif", "_6.gif", "_7.gif", "_8.gif", "_9.gif" };

        

        public cronometro()
        {
            InitializeComponent();
        }

        private void cronometro_KeyDown(object sender, KeyEventArgs e)
        {
            SoundPlayer tocar = new SoundPlayer("buzina.mp3");
            //tocar.Play();

            
            
            if (e.KeyCode == Keys.Space)
            {
                timer1.Enabled = true;
                timer1.Start();
                
                
                lmm1.Text = "000001";
                
               
                     
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            DateTime agora = DateTime.Now;

            DateTime start;
            TimeSpan time;

            start = DateTime.Now;

            //do something here

            time = DateTime.Now - start;

            cont++;
            
            string mm1 = (((cont % 1000 ) % 10)).ToString();
            string seg = (start.AddSeconds(+1)).ToString();

            /*
            if (Convert.ToInt32(mm1) >= 59)
            {
                //string mm_1 = mm1.Substring(0,1);
                //string mm_2 = mm1.Substring(1, 1);
                lmm1.Text = mm1;
               // lmm2.Text = mm_2;
                lSeg.Text = seg;
                
                //pic_seg.Image = main_fx.Properties.Resources.(strNomeArquivo);

                   
               // pic_seg.ImageLocation ="Resources\\"+ strNomeArquivo;
                
                

        
            }
            else
            {
                
                    lmm1.Text = mm1;
                    lSeg.Text = seg;
                    //lSeg.Text = seg;
            }

            


            lmm2.Text = DateTime.Now.ToLongTimeString();

            

            */
            if (segundos < 8) { 
                milissegundos += 11.850;

                if (milissegundos >= 100)
                {
                    milissegundos = 0;

                    segundos++;

                
                }
            }
            lmm1.Text = milissegundos.ToString();
            lSeg.Text = segundos.ToString();
            
        }

        private void cronometro_Load(object sender, EventArgs e)
        {
            
        }
    }
}

